#pragma once
#ifndef __G_RECTANGLE_ORIENTED_H__
#define __G_RECTANGLE_ORIENTED_H__

#include "GVector2.h"
#include "GUtilities/GTypes.h"

namespace GMath
{

	class GRay2;
	class GCircle;
	class GTriangle2;

	enum GRectangleCorner
	{
		G_RC_BOTTOM_LEFT	= 0,
		G_RC_BOTTOM_RIGHT	= 1,
		G_RC_TOP_LEFT		= 2,
		G_RC_TOP_RIGHT		= 3,
		
		G_RC_COUNT			= 4,
	};

	class GRectangleOriented
	{
	protected:
		GVector2			Right;
		GVector2			Up;

	public:
		GVector2			Center;
		GVector2			Dimension;

							GRectangleOriented();
							GRectangleOriented(const GVector2& Center, const GVector2& Dimension, float Rotation);
							GRectangleOriented(const GVector2& Center, const GVector2& Dimension, const GVector2& Right, const GVector2& Up);

		void				Create(const GVector2& Center, const GVector2& Dimension, float Rotation);
		void				Create(const GVector2& Center, const GVector2& Dimension, const GVector2& Right, const GVector2& Up);

		GVector2			GetDimension() const;
		GVector2			GetCenter() const;

		const GVector2&		GetUp() const;
		const GVector2&		GetRight() const;

		float				Area() const;
		float				Circumference() const;
	
		void				GetCorners(OUTPUT GVector2 Arr[G_RC_COUNT]) const;
		GVector2			GetCorner(GRectangleCorner Corner) const;

		const GRectangleOriented& operator = (const GRectangleOriented& Other);
	};

}

#endif